// Copyright (c) 2022 Presto Labs Pte. Ltd.
// Author: qiang

#pragma once

#include <memory>
#include <string>

#include "coin2/exchange/base/order/order.h"
#include "coin2/exchange/apollox/api_order/native_private_client.h"

namespace coin2::exchange::apollox::api_order {

class ApolloxRestAsyncAsioSubscriber : public base::order::RestSubscriber {
 public:
  using RestParams = coin2::exchange::order::ApolloxRestParams;
  using RestClient = ApolloxNativePrivateClient;

 public:
  using RestSubscriber::RestSubscriber;

  auto rest_client() { return dynamic_cast<RestClient*>(rest_client_); }
  void QueryBalance();
  void QueryOpenOrders(const std::string& native_symbol);
  void QueryHistoryOrders(const std::string& native_symbol);
  void QueryFills(const std::string& native_symbol);
  void GenListenKey();
  void SubscribeAsync() override;

 private:
  int64_t last_query_transfer_ts_{0};
};

}  // namespace coin2::exchange::apollox::api_order
